/**
 *  @file sprite.h
 *
 *  @date 16-nov-2009
 *  @author Ives van der Flaas
 */

#ifndef SPRITE_H_
#define SPRITE_H_

#include <tr1/memory>
#include "representation.h"
#include "boundingBox.h"
#include "controller.h"
#include "vector2.h"


namespace si
{

/**
 * Anything Visual in our little Game will be a sprite. Every sprite has
 * a representation that represents that sprite. A sprite has a position and
 * a controller.
 */
class Sprite
{
public:
	friend class CollisionDetector;

	Sprite(){}
	/**
	 * Ctor
	 * @param virtualSize The sprite's virtual size...
	 * @return
	 */
	Sprite(	si::Vector2 virtualSize);
	/**
	 * This function will update the object to make sure it is up to date
	 * for the next frame. Updating includes, but is not limited to updating
	 * the controller and representation.
	 * @param time Time passed in seconds
	 */
	virtual void update(double time) { fController->update(time); }

	/**
	 * Draw this Sprite's Representation
	 */
	virtual void draw() const { fRepresentation->draw(fController->getPosition(), fVirtualSize); }


protected:
	std::tr1::shared_ptr<Representation> fRepresentation;
	std::tr1::shared_ptr<Controller> fController;
	std::tr1::shared_ptr<BoundingBox> fBoundingBox;
	Vector2 fVirtualSize;
};

}

#endif /* SPRITE_H_ */
